<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <script th:fragment="js" type="text/javascript" th:inline="text">
        /*<![CDATA[*/
        /**
         * Created by 张乐平 on 8/2 0002.
         */

        jQuery(function () {
            function getTree() {
                // Some logic to retrieve, or generate tree structure
                return [
                    {
                        text: "用户管理",
                        href: "[[@{/system/authorization/users}]]"

                    },
                    {
                        text: "角色管理",
                        href: "[[@{/system/authorization/roles/query}]]"
                    },
                    {
                        text: "授权管理",
                        href: "[[@{./query}]]",
                        state: {
                            checked: true,
                            disabled: false,
                            expanded: true,
                            selected: true
                        }
                    }
                ];
            }

            $('#tree').treeview({enableLinks:true,data: getTree()});
            $('#myModal').modal('hide');

            $('#myModal').on('hide.bs.modal', function () {
                //alert('嘿，我听说您喜欢模态框...');
            })
        });

        var confirmDelUser = function (roleId) {
            $("#myModal-del").modal("show");
            $("#doDel").one("click", function () {
                window.location = "[[@{./del}]]?roleId="+roleId;
            });
        };
        var showUser111 = function (roleId) {
            $.ajax({
                type: "post",
                url: "./query",
                data:{
                    roleId:roleId
                },
                dataType: "json",
                async: true,
                success: function (data) {
                    $('#jiese').val(data.roleName);
                    $('#miaoshu').val(data.description);
                    $('#fanwei').val(data.dataDomain);
                    $('#duixiang').val(data.dataType);
                    $('#quanxian').val(data.operation);
                    $('#id').val(data.id);
                    $("#roleId").val(data.roleId);
                    $("#myModal-update").modal("show");
                }
            });
        };
        function addUpdatetr(){
            $("#myUpdateTable").append("<tr id='trUpdate"+updateNum+"'><td><input type='text' name='list["+updateNum+"].dataType' id='list["+updateNum+"].dataType' class='form-control'></td> <td><input type='text' name='list["+updateNum+"].operation' id='list["+updateNum+"].operation' class='form-control'></td> <td><input type='text' name='list["+updateNum+"].dataDomain' id='list["+updateNum+"].dataDomain' class='form-control'></td> <td><span class='glyphicon glyphicon-trash' onclick='delUpdate("+updateNum+")' style='margin-bottom: .5em;'/></td> </tr>");
            updateNum++;
        }
        function delUpdate(num){
            $("#trUpdate"+num).remove();
        }
        /*]]>*/
    </script>
</head>
</html>